Allow global_asm! in statement positions#156582
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
fc5f2bf to
76f8edb
Compare
daxpedda
commented
May 14, 2026
76f8edb to
d0629e2
Compare
Member
|
I'm happy with the asm part of this but I'm not an expert on the macro infrastructure, so... |
Contributor
|
Thanks! |
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
3e29858 to
450cdb5
Compare
Contributor
Author
|
@rustbot ready |
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
@daxpedda: 🔑 Insufficient privileges: not in review users |
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
@daxpedda: 🔑 Insufficient privileges: not in review users |
This comment was marked as resolved.
This comment was marked as resolved.
petrochenkov
approved these changes
May 18, 2026
Contributor
|
@bors r+ |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
May 18, 2026
…uwer Rollup of 13 pull requests Successful merges: - #156709 (stdarch subtree update) - #155006 (stabilize `feature(cfg_target_has_atomic_equal_alignment)`) - #156444 (Implement `OsStr::split_at`) - #156582 (Allow `global_asm!` in statement positions) - #156661 (Remove `UncheckedIterator`) - #152367 (Derives `Copy` for `ffi::FromBytesUntilNulError`) - #156443 (Fix invalid suggestion for parenthesized break) - #156606 (Add pext/pdep as aliases for extract_bits/deposit_bits) - #156630 (Replace `println!` with `assert!` in HashMap documentation examples) - #156644 (Widen the result of `widening_mul`.) - #156653 (Update `sysinfo` version to `0.39.2`) - #156697 (Add diagnostic items for IoBufReader and StdinLock) - #156704 (reduce usage of `box_patterns` in tests)
rust-timer
added a commit
that referenced
this pull request
May 18, 2026
Rollup merge of #156582 - daxpedda:global-asm-statement, r=petrochenkov Allow `global_asm!` in statement positions This PR makes it possible to put `global_asm!` in statement positions. This is particularly useful for proc-macros, where you otherwise have to wrap them in `mod foo { global_asm!(...); }`. I'm happy to open an ACP first (or a design meeting?). I would also assume this needs sign-off from the lang-team? Previously discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/216763-project-inline-asm/topic/Item.20position.20global_asm/with/581784943). r? @Amanieu
Contributor
|
Does this not need some sort of FCP? Currently this extension is effectively instantly stable, and as #156760 shows I think there are some places in the compiler where we just assume that global asm is top-level. |
Member
|
Yeah let's revert this so that the lang team can take a look without time pressure. |
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
May 24, 2026
…-item, r=workingjubilee Revert "Allow `global_asm!` in statement positions" This reverts commit 450cdb5. Based on discussion in [#t-lang > insta-stable &rust-lang#96;global_asm!&rust-lang#96; as inner items](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/insta-stable.20.60global_asm.21.60.20as.20inner.20items/with/597411711), rust-lang#156582 should not have been merged without FCP. We've also since found a bug in the implementation (or really, an assumption in the existing code that the PR invalidates), so to re-land this - new behavior should be behind a feature gate - the fix in rust-lang#156855 (comment) should be included (and reviewed by someone familiar with `rustc_resolve`) Then we keep it unstable for a bit, and see if the fuzzer finds anything else. Nothing here is particularly controversial I think, but we need to do our due diligence. r? @ghost
rust-timer
added a commit
that referenced
this pull request
May 24, 2026
Rollup merge of #156884 - folkertdev:revert-global-asm-inner-item, r=workingjubilee Revert "Allow `global_asm!` in statement positions" This reverts commit 450cdb5. Based on discussion in [#t-lang > insta-stable `global_asm!` as inner items](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/insta-stable.20.60global_asm.21.60.20as.20inner.20items/with/597411711), #156582 should not have been merged without FCP. We've also since found a bug in the implementation (or really, an assumption in the existing code that the PR invalidates), so to re-land this - new behavior should be behind a feature gate - the fix in #156855 (comment) should be included (and reviewed by someone familiar with `rustc_resolve`) Then we keep it unstable for a bit, and see if the fuzzer finds anything else. Nothing here is particularly controversial I think, but we need to do our due diligence. r? @ghost
This was referenced May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View all comments
This PR makes it possible to put
global_asm!in statement positions. This is particularly useful for proc-macros, where you otherwise have to wrap them inmod foo { global_asm!(...); }.I'm happy to open an ACP first (or a design meeting?).
I would also assume this needs sign-off from the lang-team?
Previously discussed on Zulip.
r? @Amanieu